﻿using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using PMS.Domain.AggregatesModel.ProjectAggregate;
using PMS.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace PMS.Web.Infrastructure
{
    public class PMSContextSeed
    {

        public async Task SeedAsync(PMSContext context, IHostingEnvironment env, ILogger<PMSContextSeed> logger)
        {

            ///添加项目状态数据
            if (!context.ProjectStatus.Any())
            {
                context.ProjectStatus.AddRange(ProjectStatus.List());
            }

            //添加审核类型数据
            if (!context.ProjectAuditStatus.Any())
            {
                context.ProjectAuditStatus.AddRange(ProjectAuditStatus.List());
            }
            await context.SaveChangesAsync();
        }

    }

}
